package com.yueke.gemini.service;

import java.util.List;

import com.yueke.gemini.entity.Page;
import com.yueke.gemini.mapper.ItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 业务层实现
 * created by admin 2020/3/28 10:34
 */
@Service
public class ItemServiceImpl implements ItemService{

	@Autowired
	private ItemMapper itemMapper;

	/*
	 * pageNum：当前页码
	 * numPerPage：每页记录数目
	 */
	@Override
	public Page findByPage(int pageNum, int numPerPage) {
		Page page = new Page();
		page.setNumPerPage(numPerPage);
		page.setCurrent(pageNum);

		Integer totalCount = 20;//itemMapper.getItemsCount();
		page.setTotalCount(totalCount);//设置总记录数

		int start = (pageNum - 1)*numPerPage;
		List list = null; //itemMapper.findByPage(start, numPerPage);
		page.setItems(list);//设置当前页面数据
		return page;
	}

}
